//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.atguigu.gulimall.coupon.controller;

import com.atguigu.common.utils.PageUtils;
import com.atguigu.common.utils.R;
import com.atguigu.gulimall.coupon.entity.SpuBoundsEntity;
import com.atguigu.gulimall.coupon.service.SpuBoundsService;
import java.util.Arrays;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping({"coupon/spubounds"})
public class SpuBoundsController {
    @Autowired
    private SpuBoundsService spuBoundsService;

    public SpuBoundsController() {
    }

    @RequestMapping({"/list"})
    public R list(@RequestParam Map<String, Object> params) {
        PageUtils page = this.spuBoundsService.queryPage(params);
        return R.ok().put("page", page);
    }

    @RequestMapping({"/info/{id}"})
    public R info(@PathVariable("id") Long id) {
        SpuBoundsEntity spuBounds = (SpuBoundsEntity)this.spuBoundsService.getById(id);
        return R.ok().put("spuBounds", spuBounds);
    }

    @PostMapping({"/save"})
    public R save(@RequestBody SpuBoundsEntity spuBounds) {
        this.spuBoundsService.save(spuBounds);
        return R.ok();
    }

    @RequestMapping({"/update"})
    public R update(@RequestBody SpuBoundsEntity spuBounds) {
        this.spuBoundsService.updateById(spuBounds);
        return R.ok();
    }

    @RequestMapping({"/delete"})
    public R delete(@RequestBody Long[] ids) {
        this.spuBoundsService.removeByIds(Arrays.asList(ids));
        return R.ok();
    }
}
